package org.zhadoop.stream.cql.semanticanalyzer.parser.visitor;

import org.antlr.v4.runtime.misc.NotNull;
import org.zhadoop.stream.cql.semanticanalyzer.parser.CQLParser.FromSourceContext;
import org.zhadoop.stream.cql.semanticanalyzer.parser.CQLParser.JoinTokenContext;
import org.zhadoop.stream.cql.semanticanalyzer.parser.CQLParser.OnConditionContext;
import org.zhadoop.stream.cql.semanticanalyzer.parser.context.JoinRigthBodyContext;

/**
 * join right 部分语法遍历
 * 
 * @author zwd
 *
 */
public class JoinRightBodyVisitor extends AbsCQLParserBaseVisitor<JoinRigthBodyContext> {

	private JoinRigthBodyContext context = null;

	public JoinRightBodyVisitor() {
		context = new JoinRigthBodyContext();
	}

	@Override
	protected JoinRigthBodyContext defaultResult() {
		return context;
	}

	@Override
	public JoinRigthBodyContext visitJoinToken(@NotNull JoinTokenContext ctx) {
		JoinTokenVisitor visitor = new JoinTokenVisitor();
		context.setJoinType(visitor.visit(ctx));
		return context;
	}

	@Override
	public JoinRigthBodyContext visitFromSource(@NotNull FromSourceContext ctx) {
		FromSourceVisitor visitor = new FromSourceVisitor();
		context.setRightStream(visitor.visit(ctx));
		return context;
	}

	@Override
	public JoinRigthBodyContext visitOnCondition(@NotNull OnConditionContext ctx) {
		OnConditionVisitor visitor = new OnConditionVisitor();
		context.setOnCondition(visitor.visit(ctx));
		return context;
	}
}
